package com.alinesno.cloud.initializr.starter.service;

import java.util.List;

import com.alinesno.cloud.common.facade.services.IBaseService;
import com.alinesno.cloud.initializr.starter.dto.BuildDto;
import com.alinesno.cloud.initializr.starter.entity.BuildProjectParamsEntity;
import com.alinesno.cloud.initializr.starter.entity.ProjectInfoEntity;
import com.alinesno.cloud.initializr.starter.seedgen.bean.ProjectInfoDto;

/**
 * 【请填写功能名称】Service接口
 *
 * @author alinesno
 * @date 2021-06-05
 */
public interface IBuildProjectInfoService extends IBaseService<ProjectInfoEntity> {

	/**
	 * 上传并生成gitlab工程地址
	 * 
	 * @param dto
	 * @return
	 */
	ProjectInfoEntity uploadGitProject(ProjectInfoDto dto);

	/**
	 * 发布deployment
	 * 
	 * @param projectId
	 */
	void publicDeployment(String projectId, BuildProjectParamsEntity params);

	/**
	 * 发布service
	 * 
	 * @param projectId
	 */
	void publicService(String projectId, BuildProjectParamsEntity params);

	/**
	 * 发布ingress
	 * 
	 * @param projectId
	 */
	void publicIngress(String projectId, BuildProjectParamsEntity params);

	/**
	 * 构建镜像
	 * 
	 * @param projectId       项目id
	 * @param personNamespace 用户命名空间
	 * @return
	 */
	String buildDocker(String projectId, BuildDto dto);

	/**
	 * 删除jenkins任务
	 * 
	 * @param jobName
	 */
	void deleteJenkinsJob(String jobName);

	/**
	 * 判断业务是否构建完成
	 * 
	 * @param jenkinsJobName
	 * @return
	 */
	boolean isFinishJob(String jenkinsJobName);

	/**
	 * 发布到k8s中
	 * 
	 * @param projectId
	 * @param params
	 */
	void publicK8S(String projectId, BuildProjectParamsEntity params);

	/**
	 * 生成工程并上传gitlab地址
	 * 
	 * @param dto
	 * @param templateId
	 * @return
	 */
	ProjectInfoEntity uploadGitProject(ProjectInfoDto dto, String templateId);

	/**
	 * 根据项目标识查询项目
	 * 
	 * @param projectCode
	 * @return
	 */
	List<ProjectInfoEntity> queryProjectInfoByCode(String projectCode);

	/**
	 * 保存部分信息
	 * 
	 * @param dto
	 * @return
	 */
	ProjectInfoEntity halfSave(ProjectInfoDto dto);

	/**
	 * 上传到gitea
	 * 
	 * @param dto
	 * @return
	 */
	ProjectInfoEntity uploadGiteeProject(ProjectInfoDto dto);

	/**
	 * 上传并初始化工程到gitea
	 * 
	 * @param dto
	 * @return
	 */
	ProjectInfoEntity uploadGiteaProject(ProjectInfoDto dto);
}
